//
//  YKPushGuideViewController.m
//  百思不得姐
//
//  Created by Eric.Wu on 16/2/29.
//  Copyright © 2016年 Eric.Wu. All rights reserved.
//

#import "YKPushGuideViewController.h"

@interface YKPushGuideViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *pushBottomView;

@end

@implementation YKPushGuideViewController

- (IBAction)buttonClick:(id)sender {
    YKLog(@"%s",__func__);
    [self dismissViewControllerAnimated:YES completion:nil];
}


+ (void)show
{
    
    NSString *key = @"CFBundleShortVersionString";
    
    // 获得当前软件的版本号
    NSString *currentVersion = [NSBundle mainBundle].infoDictionary[key];
    // 获得沙盒中存储的版本号
    NSString *sanboxVersion = [[NSUserDefaults standardUserDefaults] stringForKey:key];
    
    if (![currentVersion isEqualToString:sanboxVersion]) {
        UIWindow *window = [UIApplication sharedApplication].keyWindow;
        
        YKPushGuideViewController *guide = [[YKPushGuideViewController alloc] init];
        guide.view.frame = window.bounds;
        [window addSubview:guide.view];
        
        // 存储版本号
        [[NSUserDefaults standardUserDefaults] setObject:currentVersion forKey:key];
        [[NSUserDefaults standardUserDefaults] synchronize];
    }

}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.pushBottomView.userInteractionEnabled = YES;
}



@end
